/**
 * Created by duanxiancai on 2017/1/3.
 */
/*注意:放在最后dom元素添加最后执行*/
var jqq=jQuery.noConflict();
var loading_w = 32;
function loadingInit(imgPath) {
    jqq(document).ready(function(){
        jqq('body').append('<div class="loading" onclick="javascript:loading();" style="background-color:rgba(0,0,0,0.7);position: fixed;top:0;z-index: 1000;background:rgba(0,0,0,0.7);width: 100%;height: 100%;text-align: center;  display: none;"><img src="'+imgPath+'" style="width: '+loading_w+'px;"></div>')
    });
}
//loading
function startLoading() {
    var v = jqq('.loading').css('display');
    if (v == "none"){
        jqq('.loading img').css('margin-top',(jqq(window).height()/2-loading_w/2)+'px');
        jqq('.loading').css('display','block');
        //监听浏览器窗口变化
        window.onresize=function(){
            console.info(jqq(window).height());
            jqq('.loading img').css('line-height',(jqq(window).height()/2-15)+'px');
        }
    }
}
function stopLoading() {
    var v = jqq('.loading').css('display');
    if (v == "block"){
        jqq('.loading').css('display','none');
    }
}